<template>
  <div>
    <a-row :gutter="5">
      <a-col :span="4">
        <leftTree :stage="stage" :id="id" :type="type" ref="leftTree" @selected="getTreeData"></leftTree>
      </a-col>
      <a-col :span="20">
        <a-alert style="margin-bottom: 10px" :message="title" type="warning"/>
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="digaoNum"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          @change="handleTableChange"
        >
          <span slot="actionName">
          操作
          </span>
          <span v-if="stage !== '05010' && stage !== '05050'" slot="action" slot-scope="text, record">
            <a @click="handleSz(record,'事项设置')">事项设置</a>
            <a-divider type="vertical"/>
            <a @click="handleXj(record,'分项小结')">分项小结</a>
          </span>
        </a-table>
      </a-col>
    </a-row>
    <xj ref="xjForm" :id="id" :type="type" :sxid="queryParam.id" @ok="modalFormOk"></xj>
    <sz ref="szForm" :id="id" :type="type" :sxid="queryParam.id" @ok="modalFormOk"></sz>
  </div>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {butStatus} from '../../public/butStatus'
  import sz from './sz'
  import xj from './xj'
  import columns from './indexColumns'
  import leftTree from "./leftTree";

  export default {
    props: ['id', 'type', 'stage'],
    name: "sysx",
    components: {
      sz,
      xj,
      leftTree
    },
    mixins: [JeecgListMixin, butStatus],
    data() {
      return {
        queryParam: {
          id: '',
          proid: this.id,
          typeId: this.type,
        },
        title: '---',
        typeId: this.type,
        columns: columns(this),
        disableMixinCreated: true,
        url: {
          list: '/sjxmzygl/sjWorkZtfaEve/getWorkZtfaEveInfo'
        }
      }
    },
    created() {
    },
    methods: {
      handleSz(record, name) {
        console.log(this.$refs.setForm);
        this.$refs.szForm.edit(record);
        this.$refs.szForm.title = name;
        this.$refs.szForm.isCheck = false;
        this.$refs.szForm.disableSubmit = false;
      },
      handleXj(record, name) {
        console.log(this.$refs);
        this.$refs.xjForm.edit(record);
        this.$refs.xjForm.title = name;
        this.$refs.xjForm.isCheck = false;
        this.$refs.xjForm.disableSubmit = false;
      },
      modalFormOk() {
        this.loadData();
      },
      getTreeData(data) {
        this.title = data.itemName
        this.queryParam.id = data.id
        this.loadData()
      }
    }
  }
</script>

<style scoped>

</style>